const { Sequelize, Model, DataTypes } = require('sequelize');

const sequelize = new Sequelize('mysql://root:root@127.0.0.1:3306/iai', {
  define: {
    freezeTableName: true,
        createdAt: false,
    updatedAt: false,
  },
}) 

const Article = sequelize.define(
  'fa_article',
  {
    // Model attributes are defined here
    id: {
      type: DataTypes.INTEGER,
      autoIncrement: true,
      primaryKey: true,
    },
    title: {
      type: DataTypes.STRING,
      // allowNull defaults to true
    },
    content: {
      type: DataTypes.TEXT,
      // allowNull defaults to true
    },

  },
);

(async () => {
  await sequelize.sync();
//   const jane = await User.create({
//     username: 'janedoe',
//     birthday: new Date(1980, 6, 20),
//   });
//   console.log(jane.toJSON());
    const articles = await Article.findAll();
    console.log(articles);
    // console.log('Jane\'s auto-generated ID:', jane.id);
})();